package com.example.javabasic.mianshi.fuzhulei;

import java.util.ArrayList;
import java.util.List;

/**链表*/
public class ListNode {
    public int val;
    public ListNode next = null;

    public ListNode(int val) {
        this.val = val;
    }

    @Override
    public String toString() {
        ListNode node = this;
        List<Integer> list = new ArrayList<>();
        while(node!=null){
            list.add(node.val);
            node = node.next;
        }
        return list.toString();
    }
}
